//
//  NRWCarRegularTool.m
//  New_Runway
//
//  Created by NewLife on 2018/3/7.
//  Copyright © 2018年 NelsonJ. All rights reserved.
//

#import "NRWCarRegularTool.h"

@implementation NRWCarRegularTool

+ (BOOL)isNumberAndPoint:(NSString *)string {
    
    NSString *emailRegex = @"[0-9.]";
    return [self isValidateByRegex:emailRegex text:string];
}

+ (BOOL)isVINCode:(NSString *)vinCode {
    
    NSString *regex = @"[0-9a-zA-Z]";
    return [self isValidateByRegex:regex text:vinCode];
}

+ (BOOL)isValidateByRegex:(NSString *)regex text:(NSString *)text{
    NSPredicate *pre = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex];
    return [pre evaluateWithObject:text];
}

+ (BOOL)isPhoneNum:(NSString *)phoneNum {
    
    if (phoneNum.length != 11) {
        return NO;
    }
    
    return [[phoneNum substringToIndex:1] isEqualToString:@"1"];
}

@end
